home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
email
/
mime
/
audio.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
1KB
|
41 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
__all__ = [
'MIMEAudio']
import sndhdr
from cStringIO import StringIO
from email import encoders
from email.mime.nonmultipart import MIMENonMultipart
_sndhdr_MIMEmap = {
'au': 'basic',
'wav': 'x-wav',
'aiff': 'x-aiff',
'aifc': 'x-aiff' }
def _whatsnd(data):
hdr = data[:512]
fakefile = StringIO(hdr)
for testfn in sndhdr.tests:
res = testfn(hdr, fakefile)
if res is not None:
return _sndhdr_MIMEmap.get(res[0])
continue
class MIMEAudio(MIMENonMultipart):
def __init__(self, _audiodata, _subtype = None, _encoder = encoders.encode_base64, **_params):
if _subtype is None:
_subtype = _whatsnd(_audiodata)
if _subtype is None:
raise TypeError('Could not find audio MIME subtype')
MIMENonMultipart.__init__(self, 'audio', _subtype, **_params)
self.set_payload(_audiodata)
_encoder(self)